package com.yanmaohu.nikita.utility;

import java.io.File;

/**
 * @author Bright Lee
 */
public final class FileUtility {

    public static final String getTypeName(File file) {
        String fileName = file.getName();
        if (!fileName.endsWith(ValueUtility.SOURCE_CODE_FILE_NAME_POSTFIX)) {
            throw new RuntimeException("The file name must end with \""+ ValueUtility.SOURCE_CODE_FILE_NAME_POSTFIX+"\", " + file.getAbsolutePath());
        }
        String typeName = file.getName().substring(0, fileName.length() - ValueUtility.SOURCE_CODE_FILE_NAME_POSTFIX.length());
        return typeName;
    }

}
